package com.ttl.common.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.struts.action.ActionServlet;

public class ReadProperties {
	public static String read(String property){
		
        String getValue="";
        Properties properties = new Properties();
        try {
            properties.load(ReadProperties.getInputStream( Constant.actionServlet ));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
//==================        		
//Properties properties = new Properties();  
//properties.load(propStream);
//String propValue = properties.getProperty("database_server");
//System.out.println("propValue="+propValue);        
//==================        
        getValue = properties.getProperty(property);
        
        return getValue;
    }

	public static InputStream getInputStream(ActionServlet servlet) {
		
		String fileName=Constant.pathResource+"config.properties";
		System.out.println("fileName="+fileName);
		InputStream propStream = servlet.getServletConfig()
				.getServletContext().getResourceAsStream(fileName);
		
		return propStream;
	}
}
